Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Conversation

@dblandin
Copy link
Contributor

This PR adds a configuration option for debug logging in order to shake out some difficult to diagnose analysis issues.

@codeclimate/review 🔎

Dir.chdir(directory) do
languages_to_analyze.each do |language|
if engine_config.debug?
$stderr.puts("Analyzing language #{language}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be the only log line that can't use Reporter#debug and has to duplicate the logic. Thoughts on just ditching it? Seems low value to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditching it sounds good to me.

@pbrisbin
Copy link
Contributor

LGTM. Note that to do CLI testing, you'll need to make a change there to display engine STDERR even in the successful case (it doesn't do this currently).

@dblandin
Copy link
Contributor Author

Note that to do CLI testing, you'll need to make a change there to display engine STDERR even in the successful case (it doesn't do this currently).

Right. I've been running the engine directly with docker run to test. For our purposes debugging some specific issues, I think it's fine if it doesn't show up during CLI runs. We just need to see the engine stderr on codeclimate.com.

Do you think this is useful enough generally to make that CLI change?

@dblandin dblandin force-pushed the devon/add-debug-logging branch from b748419 to 433c117 Compare March 22, 2016 17:21
sexp = language_strategy.run(file)
process_sexp(sexp)

processed_files_count += 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need anything here to handle the concurrency and incrementing this number?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. The join below should block until all threads return.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right but this block is executed inside the thread right? So more than one thread could try to increment this at once

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, I suppose that's true! I'll wrap the increment with a mutex.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also use this class from concurrent-ruby I think http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/AtomicFixnum.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! That's handy!

@pbrisbin
Copy link
Contributor

Do you think this is useful enough generally to make that CLI change?

Nope, just letting you know about a gotcha that I've hit before. Whoever thinks it's useful should make that change.

dblandin added a commit that referenced this pull request Mar 22, 2016
@dblandin dblandin merged commit fdc5757 into master Mar 22, 2016
@dblandin dblandin deleted the devon/add-debug-logging branch March 22, 2016 20:09
@dblandin dblandin mentioned this pull request Oct 3, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants